package 力扣._100019_将数组分割成最多数目的子数组;

public class Solution {
    public int maxSubarrays(int[] nums) {
        //最小分数就是全部进行与
        int min = nums[0];
        for (int num : nums) {
            min = min & num;
        }
        if(min>0)
            return 1;

        int total = 0, t = 0x11111111;
        int i = 0;
        while (i < nums.length) {
            t = 0xffffffff;
            while (i < nums.length && t != min) {
                t = t & nums[i];
                i++;
            }
            if (t == min)
                total++;
        }
        return total;

    }

    public static void main(String[] args) {
        int[] t = new int[]{22, 21, 29, 22};
        int i = new Solution().maxSubarrays(t);
        System.out.println(i);
        System.out.println(22 & 21 & 29 & 22);
        System.out.println(22 & 21);
        System.out.println(29 & 22);
    }
}
